import { getCharge,updateCharge } from "../apis/charge";
export default {
    state: {
        chargeList: [],
        chargeStatusCode: null,
    },
    effects: {
        *getChargeBySaga({ payload }, { put, call }) {
            const res = yield call(getCharge)
            console.log(res);
            yield put({ type: "initCharge", payload: res.rows })
        },
        *chargeStatusBySaga({ payload }, { put, call }) {
            const res = yield call(updateCharge, payload)
            console.log(res);
            yield put({ type: "chargeStatusCode", payload: res })
        },

    },
    reducers: {
        initCharge(state, action) {
            state.chargeList = action.payload
        },
        chargeStatusCode(state, action) {
            state.chargeStatusCode = action.payload

        }
    }
}